export default {
  SET_CATES(state, cates) {
    state.cates = cates
  },
  SET_ARTICLES(state, articles) {
    state.articles = articles
  },
  SET_COMMENTS(state, comments) {
    state.comments = comments
  },
  ADD_COMMENT(state, data) {
    console.log(state.article)
    state.article.rank += 5
    const d = new Date()
    state.comments.push({
      user: {
        id: 13,
        name: 'Valerie',
      },
      content: "We don't talk any more \n" + data.content,
      stamp: d.toLocaleString({
        month: '2-digit',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
        second: '2-digit',
      }),
      votes: [
        { type: 'like', num: 0 },
        { type: 'dislike', num: 0 },
      ],
    })
  },
}
